home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / vidhandl / cursor.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-03  |  1.5 KB  |  57 lines

  1. /* CURSOR - REPLACES ACTIVE PAGE CURSOR SHAPE     */
  2. /*   ALSO AN EXAMPLE OF VIDEO HANDLING FUNCTIONS  */
  3.  
  4. #include <stdio.h>
  5. #include <crt.h>
  6. #include <ctype.h>
  7.  
  8. #include "hextoi.c"
  9.   //hextoi defined in HEXTOI.CPP converts a string (in hexadecimal notation) to a integer
  10.  
  11. unsigned int main (unsigned int a, unsigned char * ent[3])
  12.  {
  13.     int a0;
  14.  
  15.     getcrtmode ();//updates crt_page
  16.  
  17.     if (a>2) //in case of too input parameters
  18.      {
  19.          printf (" Too much parameters - %s",ent[2]);
  20.          goto fim;
  21.      }
  22.     if (a<2) //if required parameter is missing
  23.      {
  24.         printf (" Required parameter missing");
  25.         goto fim;
  26.      }
  27.  
  28.     if (*ent[1]=='/' & *(ent[1]+1)=='?') //displays help
  29.      {
  30.         printf ("\tCURSOR\t\t\t\t\tver 1.0\t\n\n* * * Freeware version\
  31.  * * * CAN BE DISTRIBUTED FREELY * * *\n\n\
  32.  Replaces cursor shape.\n\n\t\tCURSOR <shape>\n  where :\n\
  33.  \t shape => new cursor shape (0h-FFFFh)\n\n\
  34.     By Marcio Afonso Arimura Fialho\n\
  35.  http://pessoal.iconet.com.br/jlfialho\n\
  36.  e-mail:jlfialho@iconet.com.br");
  37.         return 0;
  38.      }
  39.  
  40.     if (hextoi(&(int)a0,ent[1])) //converts input to a0 and verify if input is OK
  41.      {
  42.       jmp_error:
  43.         printf ("\nERROR: Incorrect input parameter"); //displays error message
  44.         goto fim;
  45.      }
  46.  
  47.     setcursorsh (a0); //changes cursor shape
  48.     return 0;
  49.  
  50.   fim : //displays a message and then returns
  51.     printf ("\nType \"/?\" to get help\n");
  52.     return 1;
  53.  }
  54.  
  55. // By Marcio Afonso Arimura Fialho
  56. // http://pessoal.iconet.com.br/jlfialho
  57. // e-mail: jlfialho@iconet.com.br or (alternate) jlfialho@yahoo.com